//引入组件库
var app = sm("do_App");
var page = sm("do_Page");
var nf = sm("do_Notification");
var mallUrl = require("url/mall");
var http = require("helper/http");
var userUtil = require("helper/user");
var common = require("common");

var alayoutRoot = ui("alayoutRoot");
//声明UI变量
var root=ui("$");  //$表示当前视图的根UI

root.setMapping({
	"alayoutRoot.tag" : "id"
});

var buttonExit = ui("buttonExit");
buttonExit.on("touch", function(data, e) {
	if(userUtil.loginToken()===""){
		nf.alert("您还没有登录哦.");
	}else{
		var cartId = alayoutRoot.tag;
		http.post(mallUrl.url.cart.doDelete,{"id":cartId},function(data){
			nf.toast("已移出购物车");
			page.fire("delete_cart", cartId);
		});
	}
})
